<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="css/mui.min.css" />
		<style>
			.layout{
				height: 3000px;
			}
			#getTop{
				opacity: 0;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">首页</h1>
		</header>
		
		<div class="mui-content layout">
			<div style="padding: 10px;">
				<div id="slider" class="mui-slider" >
				  <div class="mui-slider-group mui-slider-loop">
					<!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
					<div class="mui-slider-item mui-slider-item-duplicate">
					  <a href="#">
						<img src="images/images/banner3.jpg">
					  </a>
					</div>
					<!-- 第一张 -->
					<div class="mui-slider-item">
					  <a href="#">
						<img src="images/images/banner1.jpg">
					  </a>
					</div>
					<!-- 第二张 -->
					<div class="mui-slider-item">
					  <a href="#">
						<img src="images/images/banner2.jpg">
					  </a>
					</div>
					<!-- 第三张 -->
					<div class="mui-slider-item">
					  <a href="#">
						<img src="images/images/banner3.jpg">
					  </a>
					</div>
					<!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
					<div class="mui-slider-item mui-slider-item-duplicate">
					  <a href="#">
						<img src="images/images/banner1.jpg">
					  </a>
					</div>
				  </div>
				  <div class="mui-slider-indicator">
					<div class="mui-indicator mui-active"></div>
					<div class="mui-indicator"></div>
					<div class="mui-indicator"></div>
				  </div>
				</div>
			</div>
		</div>
		
		<button id="getTopBtn" type="button" class="mui-btn mui-btn-blue" style="width: 50px;height: 50px;border-radius: 50%;position: fixed;bottom: 70px;right: 20px;">顶</button>
		
		<script src="js/mui.js" type="text/javascript" charset="utf-8"></script>
		<script>
			getTop()
			function getTop () {
				document.getElementById('getTopBtn').addEventListener('tap',function () {
				        window.scroll({
							top:0,
							behavior:'smooth'
						})
				})
			}
			changeScroll()
			function changeScroll () {
				let slider = document.getElementById("slider")
				let gt = document.getElementById("getTopBtn")
				window.addEventListener('scroll',function(){
					let bHeigt = document.body.clientHeight
					slider.style.opacity = (slider.clientHeight-window.pageYOffset)  /  (window.pageYOffset+slider.clientHeight)
					gt.style.opacity = window.pageYOffset/(bHeigt-window.innerHeight)
				})
			}
		</script>
	</body>
</html>